"##############################################################################
" My config file for the vifm terminal file manager
"##############################################################################
set vicmd=nvim
set syscalls
set trash
set trashdir="~/.local/share/vifm/Trash"
set history=100
set nofollowlinks
set sortnumbers
set undolevels=100
set vimhelp
set norunexec
set timefmt=%d/%m/%Y\ %H:%M
" set viewcolumns=*{name}..,6{}.
set viewcolumns=-{name}..,10{}.
set rulerformat="%l/%S%[ +%x%] "
set wildmenu
set wildstyle=popup
set suggestoptions=normal,visual,view,otherpane,keys,marks,registers
set ignorecase
set smartcase
set nohlsearch
set incsearch
set scrolloff=4
set statusline=" %A %10u:%-7g %8s [%8E] %18d   %{&sort} %= %a/%c "
set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
    \phistory,fhistory,dirstack,registers,bookmarks,bmarks
set slowfs=curlftpfs

source $HOME/.config/vifm/icons.vifm
colorscheme my_everforest

"##############################################################################
" File associations
"##############################################################################
" Pdf, Djvu -------------------------------------------------------------------
" filextype *.pdf atril %c %i &, apvlv %c, xpdf %c
filextype *.pdf,*.djvu
  \ {View in atril}
  \ atril %f %i &,
  \ {View in zathura}
  \ zathura %c %i &,
  \ {View in qpdfview}
  \ qpdfview %f %i &,
filetype *.pdf,*.djvu
  \ {View in zathura}
  \ zathura %c %i &,
  \ {View in apvlv}
  \ apvlv %c &
fileviewer *.pdf
  \ vifmimg pdfpreview %px %py %pw %ph %c
  \ %pc
  \ vifmimg clear
  " \ pdftotext -nopgbrk %c -

" PostScript ------------------------------------------------------------------
filetype *.ps,*.eps,*.ps.gz
  \ {View in zathura}
  \ zathura %c %i,
  \ {View in gv}
  \ gv %c %i &,

" Audio -----------------------------------------------------------------------
filextype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus,*.aac
  \ {View using deadbeef}
  \ deadbeef %f %i &,
  \ {Play using MPlayer}
  \ mplayer %f %i &
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus,*.aac
  \ {View using cmus}
  \ $TERMINAL -e cmus %f &,
  \ {Play using ffplay}
  \ ffplay -nodisp -autoexit %c
fileviewer *.mp3 mp3info
fileviewer *.flac soxi

" Video -----------------------------------------------------------------------
filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
  \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
  \*.as[fx]
  \ {View using smplayer}
  \ smplayer %f %i &
filetype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
  \ {View using ffplay}
  \ ffplay -fs -autoexit %f
fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
  \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
  \*.as[fx]
  \ vifmimg videopreview %px %py %pw %ph %c
  \ %pc
  \ vifmimg clear

" Web -------------------------------------------------------------------------
filextype *.html,*.htm
  \ {Open with gvim}
  \ gvim %c &,
  \ {Open with vim}
  \ wezterm start --always-new-process --cwd %d -e vim %c %i &,
  \ {Open with dwb}
  \ dwb %f %i &,
  \ {Open with firefox}
  \ firefox %f &,
  \ {Open with uzbl}
  \ uzbl-browser %f %i &
filetype *.html,*.htm
  \ {Open with vim}
  \ $TERMINAL -e vim %c &,
  \ {Open with links}
  \ links %c &,
  \ {Open with lynx}
  \ lynx %c &

" Object ----------------------------------------------------------------------
filetype *.o nm %f | less

" Man page --------------------------------------------------------------------
filetype *.[1-8] man ./%c
fileviewer *.[1-8] man ./%c | col -b

" Images ----------------------------------------------------------------------
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
  \ {View in qView}
  \ qview %f %i &,
  \ {View in XnViewMP}
  \ xnviewmp %F %i &,
  \ {View in ristretto}
  \ ristretto %f &
filetype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
  \ {View in sxiv}
  \ sxiv -ia %f &,
  \ {View in imv}
  \ imv-x11 -b 1D2330 -d %d &,
  \ {View in feh}
  \ feh %d &
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm
  \ vifmimg draw %px %py %pw %ph %c
  \ %pc
  \ vifmimg clear
fileviewer *.gif
  \ vifmimg gifpreview %px %py %pw %ph %c
  \ %pc
  \ vifmimg clear

" OpenRaster ------------------------------------------------------------------
filetype *.ora
  \ {Edit in MyPaint}
  \ mypaint %f,

" Mindmap ---------------------------------------------------------------------
filetype *.vym
  \ {Open with VYM}
  \ vym %f &,

" MD5 -------------------------------------------------------------------------
filetype *.md5
  \ {Check MD5 hash sum}
  \ md5sum -c %f %S,

" SHA1 ------------------------------------------------------------------------
filetype *.sha1
  \ {Check SHA1 hash sum}
  \ sha1sum -c %f %S,

" SHA256 ----------------------------------------------------------------------
filetype *.sha256
  \ {Check SHA256 hash sum}
  \ sha256sum -c %f %S,

" SHA512 ----------------------------------------------------------------------
filetype *.sha512
  \ {Check SHA512 hash sum}
  \ sha512sum -c %f %S,

" GPG signature ---------------------------------------------------------------
filetype *.asc
  \ {Check signature}
  \ !!gpg --verify %c,

" Torrent ---------------------------------------------------------------------
filextype *.torrent qbittorrent %f %i &, tixati %f &
fileviewer *.torrent dumptorrent -v %c

" FuseZipMount ----------------------------------------------------------------
filextype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg
  \ {View contents}
  \ engrampa %f &
filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg
  \ {Mount with fuse-zip}
  \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR,
  \ {View contents}
  \ zip -sf %c | less,
  \ {Extract here}
  \ tar -xf %c
fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c

" ArchiveMount ----------------------------------------------------------------
filextype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz
  \ {View contents}
  \ engrampa %f &
filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz
  \ {Mount with archivemount}
  \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR,
  \ {View contents}
  \ zip -sf %c | less,
  \ {Extract here}
  \ tar -xf %c
fileviewer *.tgz,*.tar.gz tar -tzf %c
fileviewer *.tar.bz2,*.tbz2 tar -tjf %c
fileviewer *.tar.txz,*.txz xz --list %c
fileviewer *.tar tar -tf %c

" Rar2FsMount and rar archives ------------------------------------------------
filextype *.rar
  \ {View contents}
  \ engrampa %f &
filetype *.rar
  \ {Mount with rar2fs}
  \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR
fileviewer *.rar unrar v %c

" Fuse7z and 7z archives ------------------------------------------------------
filextype *.7z
  \ {View contents}
  \ engrampa %f &
filetype *.7z
  \ {Mount with fuse-7z}
  \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR
fileviewer *.7z 7z l %c

" IsoMount --------------------------------------------------------------------
filetype *.iso
  \ {Mount with fuseiso}
  \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR,

" SshMount --------------------------------------------------------------------
filetype *.ssh
  \ {Mount with sshfs}
  \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND,

" FtpMount --------------------------------------------------------------------
filetype *.ftp
  \ {Mount with curlftpfs}
  \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND,

" Office files ----------------------------------------------------------------
filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx,*.ppt wps %f &, libreoffice %f &
fileviewer *.doc catdoc %c
fileviewer *.docx docx2txt.pl %f -

" TuDu files ------------------------------------------------------------------
filetype *.tudu tudu -f %c

" Qt projects -----------------------------------------------------------------
" filextype *.pro qtcreator %f &
filextype *.pro wezterm start --always-new-process --cwd %d -e vim %f %i &
filetype *.pro $TERMINAL -e vim %f &

" Directories -----------------------------------------------------------------
filextype */
  \ {View in dolphin}
  \ dolphin %f &,
  \ {View in thunar}
  \ Thunar %f &
filextype */
  \ {View in Vifm}
  \ vifm %f &,
  \ {View in Yazi}
  \ yazi %f &,
  \ {View in Ranger}
  \ ranger %f &

" Config & exec files ---------------------------------------------------------
filextype *.conf,*rc,*.txt,*.yml,*.json,config,*.fish,*.sh,*.ini,*.css,*.bak,*.backup,*info,*.md,*.dat,*.xml,*.Xresources,*.asm,*.py,*.c,*.cpp,*.h,*.awk,*bash*,*.git*,*.zsh,*zshrc,*.profile,*.log,*.desktop,*.vifm,*.vim,*.rs,*.hs,*.lua,*.go,*.org,*.el,*.toml,*.yml,*.lock,*.sql,*.pas,*.dart/
  \ {View in vim}
  \ alacritty -e vim %f %i &,
  \ {View in gvim}
  \ gvim %f &,
  \ {View in vim (wezterm terminal)}
  \ wezterm start --always-new-process --cwd %d -e vim %f %i &,
  \ {View in vim (kitty terminal)}
  \ kitty -e vim %f %i,

filetype *.conf,*rc,*.txt,*.yml,*.json,config,*.fish,*.sh,*.ini,*.css,*.bak,*.backup,*info,*.md,*.dat,*.xml,*.Xresources,*.asm,*.py,*.c,*.cpp,*.h,*.awk,*bash*,*.git*,*.zsh,*zshrc,*.profile,*.log,*.desktop,*.vifm,*.vim,*.rs,*.hs,*.lua,*.go,*.org,*.el,*.toml,*.yml,*.lock,*.sql,*.pas,*.dart/
  \ {View in vim}
  \ alacritty -e vim %f %i &,
  \ {View in vim (wezterm terminal)}
  \ wezterm start --always-new-process --cwd %d -e vim %f %i &,
  \ {View in vim (kitty terminal)}
  \ kitty -e vim %f %i &,
  \ {View in Helix}
  \ $TERMINAL -e hx %f %i &,

" filetype *.conf,*rc,*.txt,*.yml,*.json,config,*.fish,*.sh,*.ini,*.css,*.bak,*.backup,*info,*.md,*.dat,*.xml,*.Xresources,*.asm,*.py,*.c,*.cpp,*.h,*.awk,*bash*,*.git*,*.zsh,*zshrc,*.profile,*.log,*.desktop,*.vifm,*.vim,*.rs,*.hs,*.lua,*.org,*.el $TERMINAL -e vim %f &

" Books -----------------------------------------------------------------------
" filextype *.fb2,*.epub cr3 %f %i &
filextype *.fb2,*.epub
  \ {View in Foliate}
  \ foliate %f %i &,
  \ {View in cr3}
  \ cr3 %f %i &,
  \ {View in FBReader}
  \ FBReader %f %i &,

" Fonts -----------------------------------------------------------------------
filextype *.ttf,*.otf gnome-font-viewer %f %i &

" .deb ------------------------------------------------------------------------
filextype *.deb gdebi-gtk %f &, engrampa %f %i &

"##############################################################################
" Syntax highlighting in preview
"##############################################################################
" Explicitly set highlight type for some extensions ---------------------------
" 256-color terminal
" fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c
" fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
"
" 16-color terminal
" fileviewer *.c,*.h highlight -O ansi -s dante %c
"
" Or leave it for automatic detection -----------------------------------------

fileviewer *[^/] pygmentize -O style=monokai -f console256 -g

" Displaying pictures in terminal ---------------------------------------------
"
" fileviewer *.jpg,*.png shellpic %c

" Open all other files with default system programs (you can also remove all
" :file[x]type commands above to ensure they don't interfere with system-wide
" settings).  By default all unknown files are opened with 'vi[x]cmd'
" uncommenting one of lines below will result in ignoring 'vi[x]cmd' option
" for unknown file types.
" For *nix:
" filetype * xdg-open
" For OS X:
" filetype * open
" For Windows:
" filetype * start, explorer

"##############################################################################
" Marks
"##############################################################################
" :mark mark /full/directory/path [filename]
mark h ~/
mark d ~/Desktop
mark w ~/Downloads
mark b ~/OS/Linux/+backup
mark p ~/Projects
mark r ~/Programs
mark f ~/Documents/forProgramming
mark c ~/.config
mark s ~/.myScripts
mark l ~/.local/share
mark a ~/.cache

" mark M /run/media
mark M /media
mark R /

"##############################################################################
" Commands
"##############################################################################
" Archives -------------------------------------------------------------------
command! zip zip -9 -r %c.zip %f
command! unzip unzip %f
command! tar tar -czvf %c.tar.gz %f
command! untar tar -xzvf %f

" Copy and move (instead of copy and move) WITH menu dialog -------------------
command! cp :yank | winrun , put
command! mv :yank | winrun , put!

command! diff vim -d %f %F
command! run !! ./%f
command! mkcd :mkdir %a | cd %a
command! reload :write | restart

" Edit image in XnViewMP (cause file not found) -------------------------------
command! editimage :!xnviewmp (echo %d/%c)

" Create a file or a dir (for dir last char must be '/')
command! create :
\|  let $last_char = expand(system("str=\"%a\"; echo \"${str: -1}\""))
\|  if $last_char == "/"
\|    mkdir "%a"
\|  else
\|    touch "%a"
\|  endif

" Toggle detailed/brief information about files -------------------------------
command! togglefilesinfo
    \ : if &viewcolumns == '-{name}..,10{}.'
    \ |   set viewcolumns=*{name}..,10{size}.
    \ |   echo 'Files information: detailed'
    \ | else
    \ |   set viewcolumns='-{name}..,10{}.'
    \ |   echo 'Files information: brief'
    \ | endif

command! togglefilesmoreinfo
    \ : if &viewcolumns == '-{name}..,10{}.'
    " \ |   set viewcolumns=*{name}.,10{size}.,12{perms},10{uname},-7{gname},18{mtime}
    " \ |   set viewcolumns=*{name}..,{ext},10{size}.,12{perms},10{uname},-10{gname},18{mtime}
    \ |   set viewcolumns=*{name}..,10{size}.,18{mtime}
    \ |   echo 'Files information: detailed'
    \ | else
    \ |   set viewcolumns='-{name}..,10{}.'
    \ |   echo 'Files information: brief'
    \ | endif

" Reset sort ------------------------------------------------------------------
command! resetsort
    \ : if &sort != '+name'
    \ |   set sort=+name
    \ |   echo 'Reset sort to +name'
    \ | endif

" Open most used tabs ---------------------------------------------------------
command! openProgrammingDirs
    \ :tabonly
    \ | tabnew
    \ | tabname Rust
    \ | cd ~/Documents/forProgramming/Rust/Books/ ~/Projects/Rust/
    \ | tabnew
    \ | tabname Lua
    \ | cd ~/Documents/forProgramming/Lua/Books/ ~/Projects/Lua/
    \ | tabnew
    \ | tabname Haskell
    \ | cd ~/Documents/forProgramming/Haskell/Books/ ~/Projects/Haskell/
    \ | tabnext 1
    \ | tabclose

command! openBackupDirs
    \ :tabonly
    \ | tabnew
    \ | tabname Backups
    \ | cd ~/OS/Linux/+backup/DropboxDesktop/Desktop/ ~/.config/
    \ | tabnew
    \ | tabname yay
    \ | cd ~/.cache/yay ~/.cache/yay_Backups
    \ | tabnew
    \ | tabname Kernel
    \ | cd ~/OS/Linux/+backup/Drivers/NVidia/GeForce9600GT/WorksOnLinuxKernel419/Kernel419/ /var/cache/pacman/pkg/
    \ | tabnext 1
    \ | tabclose

"##############################################################################
" Mappings
"##############################################################################
" Archives --------------------------------------------------------------------
nnoremap <wait> ,cz :!alacritty -e zip -9 -r %c.zip %f & <cr>
nnoremap <wait> ,xz :!alacritty -e unzip %f & <cr>
nnoremap <wait> ,ct :!alacritty -e tar -czvf %c.tar.gz %f & <cr>
nnoremap <wait> ,xt :!alacritty -e tar -xzvf %f & <cr>
" nnoremap <wait> ,cz :zip <cr>
" nnoremap <wait> ,xz :unzip <cr>
" nnoremap <wait> ,ct :tar <cr>
" nnoremap <wait> ,xt :untar <cr>
nnoremap <wait> ,ac :!engrampa --add %f &<cr>
nnoremap <wait> ,ax :!engrampa -f %f &<cr>

" Open all images in current directory in sxiv thumbnail mode -----------------
nnoremap sx :!sxiv -t %d &<cr>

" Open file in the background using its default program -----------------------
nnoremap gb :file &<cr>l

" Open selected images in gimp ------------------------------------------------
nnoremap gp :!gimp %f %i &<cr>

" Open selected files in gvim -------------------------------------------------
nnoremap gv :!gvim %f %i &<cr>

" Open selected files in xnviewmp ---------------------------------------------
nnoremap ge :editimage<cr>

" Start shell in current directory --------------------------------------------
nnoremap s :shell<cr>

" Open poetry shell (.venv) ---------------------------------------------------
nnoremap <wait> ,,pa :!alacritty -e poetry shell &<cr>
nnoremap <wait> ,,pk :!kitty -e poetry shell %i &<cr>
nnoremap <wait> ,,pw :!wezterm start --always-new-process --cwd %d -e poetry shell &<cr>

" Open console in current directory -------------------------------------------
nnoremap <wait> ,,t :!$TERMINAL &<cr>
nnoremap <wait> ,,a :!alacritty &<cr>
nnoremap <wait> ,,k :!kitty %i &<cr>
nnoremap <wait> ,,w :!wezterm start --always-new-process --cwd %d %i &<cr>

" Open console as root in current directory -----------------------------------
nnoremap <wait> ,,rt :!pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $TERMINAL &<cr>
nnoremap <wait> ,,ra :!pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY alacritty &<cr>
nnoremap <wait> ,,rw :!pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY wezterm-gui start --cwd %d %i &<cr>
nnoremap <wait> ,,rk :!pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY kitty %i &<cr>

" Open selected files in vim (different terminals) ----------------------------
nnoremap ,,va :!alacritty -e vim %f &<cr>
nnoremap ,,vk :!kitty -e vim %f %i &<cr>
nnoremap ,,vw :!wezterm start --always-new-process --cwd %d -e vim %f %i &<cr>

" Open selected files as root in vim (different terminals) --------------------
nnoremap ,,rva :!pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY alacritty --working-directory %d -e vim %f %i &<cr>
nnoremap ,,rvk :!pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY kitty -d %d -e vim %f %i &<cr>
nnoremap ,,rvw :!pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY wezterm-gui start --cwd %d -e vim %f %i &<cr>

" nohlsearch ------------------------------------------------------------------
nnoremap ,nh :nohlsearch<cr>

" Display sorting dialog ------------------------------------------------------
nnoremap S :sort<cr>

" Toggle visibility of preview window -----------------------------------------
nnoremap w :view<cr>
vnoremap w :view<cr>gv

" yank current directory path into the clipboard ------------------------------
nnoremap yd :!echo -n %d | xclip -sel clipboard %i<cr>:echo expand('%"d') "is yanked to clipboard"<cr>

" yank current file path into the clipboard -----------------------------------
nnoremap yf :!echo -n %c:p | xclip -sel clipboard %i<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>

" yank current filename without path into the clipboard -----------------------
nnoremap yn :!echo -n %c | xclip -sel clipboard %i<cr>:echo expand('%"c') "is yanked to clipboard"<cr>

" yank root of current file's name into the clipboard -------------------------
nnoremap yr :!echo -n %c:r | xclip -sel clipboard %i<cr>:echo expand('%"c:r') "is yanked to clipboard"<cr>

" Mappings for faster renaming ------------------------------------------------
nnoremap I cw<c-a>
nnoremap cc cw<c-u>
nnoremap A cw

" Reload ----------------------------------------------------------------------
nnoremap <wait> ,r :reload<cr>

" Open bookmarks --------------------------------------------------------------
nnoremap <wait> ,b :bmarks<cr>
nnoremap <wait> ,bf :bmarks<space>

" Open editor to edit vifmrc and apply settings after returning to vifm -------
nnoremap <wait> ,ev :write | edit $MYVIFMRC | restart<cr>

" Toggle wrap setting on ,w key -----------------------------------------------
nnoremap <wait> ,w :set wrap!<cr>

" Toggle detailed/brief information about files -------------------------------
nnoremap <wait> ,it :togglefilesinfo<cr>
nnoremap <wait> ,im :togglefilesmoreinfo<cr>

" Reset sort to +name ---------------------------------------------------------
nnoremap <wait> ,s :resetsort<cr>

" Mount/Unmount windows disks: /dev/sda1 (C) and /dev/sda2 (D) ----------------
nnoremap <wait> ,mc :!~/.myScripts/winC_mount.sh<cr>
nnoremap <wait> ,md :!~/.myScripts/winD_mount.sh<cr>
nnoremap <wait> ,uc :!~/.myScripts/winC_unmount.sh<cr>
nnoremap <wait> ,ud :!~/.myScripts/winD_unmount.sh<cr>

" Quit ------------------------------------------------------------------------
map <wait> <Esc><Esc> :q!<cr>
" Quit all windows without saving
nnoremap ,,q :qa!<cr>
" Quit all windows with saving
nnoremap ,,x :xa<cr>
" Quit the current windows with saving
nnoremap ,,z :x<cr>

" Tabs ------------------------------------------------------------------------
" nnoremap <S-Tab> :tabprevious<cr>
" nnoremap <Tab> :tabnext<cr>
nnoremap ,to :tabnew<cr>
nnoremap ,tx :tabclose<cr>
nnoremap ,tp :tabprevious<cr>
nnoremap ,tn :tabnext<cr>
nnoremap ,tr :tabname<space>
nnoremap ,t1 1gt
nnoremap ,t2 2gt
nnoremap ,t3 3gt
nnoremap ,t4 4gt
nnoremap ,t5 5gt
nnoremap ,t6 6gt
nnoremap ,t7 7gt
nnoremap ,t8 8gt
nnoremap ,t9 9gt

" Move focus between panes ----------------------------------------------------
noremap <C-k> <C-w>k
noremap <C-j> <C-w>j
noremap <C-h> <C-w>h
" noremap <BS> <C-w>h
noremap <C-l> <C-w>l

" Adjust pane size (left for decreasing, right for increasing) ----------------
nnoremap <left> <C-w><
nnoremap <right> <C-w>>
nnoremap <up> <C-w>-
nnoremap <down> <C-w>+

" Moving cursor in another pane -----------------------------------------------
nnoremap <silent> J <tab>j<tab>
nnoremap <silent> K <tab>k<tab>

" Example of standard two-panel file managers mappings ------------------------
nnoremap <f3> :!$TERMINAL -e bat --paging=always %f<cr>
" nnoremap <f4> :edit<cr>
nnoremap <f4> :!$TERMINAL -e vim %f &<cr>
" nnoremap <f5> :copy<cr>
" nnoremap <f6> :move<cr>
nnoremap <f5> :cp<cr>
nnoremap <f6> :mv<cr>
nnoremap <f7> :mkdir<space>
nnoremap <c-a> :create<space>
nnoremap <f10> :q<cr>
" nnoremap <f11> :<cr>
" nnoremap <f12> :<cr>

" Midnight commander alike mappings -------------------------------------------
" Open current directory in the other pane
nnoremap <a-i> :sync<cr>
" Open directory under cursor in the other pane
nnoremap <a-o> :sync %c<cr>
" Swap panes
nnoremap <c-u> <c-w>x

" " Try to open several tabs
" tabname Rust
" cd ~/Documents/forProgramming/Rust/Books/ ~/Projects/Rust/
"
" tabnew
" tabname Lua
" cd ~/Documents/forProgramming/Lua/Books/ ~/Projects/Lua/
"
" tabnew
" tabname Haskell
" cd ~/Documents/forProgramming/Haskell/Books/ ~/Projects/Haskell/
"
" " start on the first tab
" tabnext 1

